using Headspring.Training.Domain.Services;

namespace Headspring.Training.Domain.Model.StateCommands
{
    public class CompleteToAssignedCommand : StateCommandBase
    {
        public CompleteToAssignedCommand(WorkOrder workOrder, Employee currentUser) : base(workOrder, currentUser)
        {
        }

        public override WorkOrderStatus GetBeginStatus()
        {
            return WorkOrderStatus.Complete;
        }

        protected override WorkOrderStatus GetEndStatus()
        {
            return WorkOrderStatus.Assigned;
        }

        protected override bool userCanExecute(Employee currentUser)
        {
            return currentUser == _workOrder.Creator;
        }

        public override string TransitionVerbPresentTense
        {
            get { return "Reassign"; }
        }

        public override string TransitionVerbPastTense
        {
            get { return "Reassigned"; }
        }

        protected override void postExecute(IWorkflowCoordinator coordinator)
        {
        	coordinator.SendNotification(this, _workOrder);
        	coordinator.EditWorkOrder(_workOrder);
        }
    }
}